Next | Prev | Up | Top | Contents | Index
Testing Device Physical Addresses
The functions badaddr() and wbadaddr(), summarized in Table 9-9, are used to test a physical address to find out if it represents a usable device register.
Functions to Test Physical Addresses
Function Name | Header Files | Can Sleep? | Purpose |
---|
badaddr(D3) | systm.h | N | Test physical address for input. |
badaddr_val(D3) | systm.h | N | Test physical address for input and return the input value received. |
wbadaddr(D3) | systm.h | N | Test physical address for output. |
wbadaddr_val(D3) | systm.h | N | Test physical address for output of specific value. |
The functions return a nonzero value when the address is bad, that is, unusable. Related functions for the VME bus are covered in Chapter 14.
You normally use these functions in the pfxinit() entry point to verify that an expected device is in fact present. The functions can also be useful in the pfxedtinit() entry point. However, that entry point is only called from a VECTOR statement, and the VECTOR statement can contain a PROBE argument that tests for valid hardware.
Note: These functions must not be called in an interrupt handler. Verify device addresses in the upper-half code, during initialization.
Next | Prev | Up | Top | Contents | Index